package com.huatai.bi.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huatai.bi.dto.MqttClientDto;
import com.huatai.bi.entity.MqMqttClientEntity;
import com.huatai.common.api.R;

import java.util.List;

/**
* @author songxiude
* @description 针对表【mq_mqtt_client(mqtt链接信息表)】的数据库操作Service
* @createDate 2024-07-15 14:36:47
*/
public interface MqMqttClientService extends IService<MqMqttClientEntity> {

    /**
     * 添加mqtt链接
     * @param mqMqttClient
     * @return
     */
    R mqttSave(MqMqttClientEntity mqMqttClient);

    /**
     * 修改mqtt链接信息
     * @param mqMqttClient
     * @return
     */
    boolean mqttUpdate(MqMqttClientEntity mqMqttClient);

    /**
     * 获取mqtt链接信息
     * @param mqttClientDto
     * @return
     */
    IPage<MqMqttClientEntity> mqttList(MqttClientDto mqttClientDto);

    /**
     * 手动启动mqtt
     * @param id
     * @return
     */
    boolean startMqtt(Long id);

    /**
     * 删除mqtt链接
     * @param clientId
     * @return
     */
    boolean removeMqtt(String clientId);

    /**
     * 创建链接
     * @param clientEntity
     */
    boolean initMqttServer(MqMqttClientEntity clientEntity);

	/**
	 * 停止Mqtt
	 * @param id
	 * @return
	 */
	boolean stopMqtt(Long id);

	/**
	 * 获取mqtt连接最小的实例
	 * @param ips
	 * @return
	 */
	JSONObject getMinClient(List<String> ips);

	R getMqttTree(MqMqttClientEntity dto);

	/**
	 * 根据clientId查询mqtt数据
	 * @param clientId
	 * @return
	 */
//	R getclientIdAllDate(String clientId);
}
